$(function() {
	function a(a) {
		var b = -a * h;
		$(".mdetail_goodsdet_con .detailConPanel").animate({
			left: b
		}, 100)
	}

	function b(a) {
		var b = a.find("img"),
			c = $(".mdetail_goodsdet_con");
		b.length && _.each(b, function(b) {
			var d = new Image;
			d.src = b.src, d.onload = function() {
				var b = a.outerHeight(!0);
				c.css("minHeight", b)
			}
		});
		var d = a.outerHeight(!0);
		c.css("minHeight", d)
	}

	function c() {
		function a(a) {
			if (a !== Object(a)) throw new TypeError("Invalid object");
			var b = [];
			for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && (b[b.length] = c);
			return b
		}

		function b(a, b) {
			var c = a.join(";");
			j[c] ? (j[c].stock += parseInt(b.stock), j[c].prices.push(b.price)) : j[c] = {
				stock: parseInt(b.stock),
				prices: [b.price]
			}
		}

		function c(a) {
			if (!a || !a.length) return [];
			for (var b = a.length, c = [], e = 1; b > e; e++) for (var f = d(b, e); f.length;) {
				for (var g = f.shift(), h = [], i = 0; b > i; i++) g[i] && h.push(a[i]);
				c.push(h)
			}
			return c
		}

		function d(a, b) {
			if (!b || 1 > b) return [];
			var c, d, e, f = [],
				g = [],
				h = !0;
			for (c = 0; a > c; c++) g[c] = b > c ? 1 : 0;
			for (f.push(g.concat()); h;) for (e = 0, c = 0; a - 1 > c; c++) {
				if (1 == g[c] && 0 == g[c + 1]) {
					for (d = 0; c > d; d++) g[d] = e > d ? 1 : 0;
					g[c] = 0, g[c + 1] = 1;
					var i = g.concat();
					f.push(i), -1 == i.slice(-b).join("").indexOf("0") && (h = !1);
					break
				}
				1 == g[c] && e++
			}
			return f
		}

		function e() {
			var d, e, f = a(h);
			for (d = 0; d < f.length; d++) {
				var g = f[d],
					i = h[g],
					k = g.split(";");
				k.sort(function(a, b) {
					return parseInt(b) - parseInt(a)
				});
				var l = c(k);
				for (e = 0; e < l.length; e++) b(l[e], i);
				j[k.join(";")] = {}, j[k.join(";")] = i, j[k.join(";")].stock = parseInt(i.stock), j[k.join(";")].prices = [i.price]
			}
		}


		var q = [];
		$(".mdetail_goodsimg li").each(function() {
			q.push($(this).data("img"))
		}), $(".members_con img").each(function() {
			var a = $(this);
			a.parent(".detailCode").length || (a.hasClass("lazyload") ? q.push(a.data("original")) : q.push(a.attr("src")))
		}), $(".mdetail_goodsimg li").click(function(a) {
			var b = $(this).data("img");
			window.wx && wx.previewImage({
				current: b,
				urls: q
			})
		}), initLoadMore({
			url: "/Item/detail_ajax",
			targetSelector: ".j-detail-comment",
			tpl: $("#tpl_item_detail_comment").html(),
			data: {
				id: ItemID
			},
			callback: function() {
				if ($(".mdetail_goodsdet_tit span").eq(0).is(".cur")) {
					var a = $(".mdetail_goodsdet_tit span.cur").index();
					return $(".mdetail_goodsdet_con .detailConPanel .detailCon").eq(a).show().siblings().hide(), !1
				}
				return !0
			}
		})
	}

	

	
	var d = function() {

		};
		
		
	d(), $(window).resize(function(a) {
		d()
	});
	var e = document.getElementById("mySwipe");
	window.mySwipe = Swipe(e, {
		startSlide: 0,
		auto: 3e3,
		callback: function(a) {
			indexs.eq(a).addClass("cur").siblings().removeClass("cur")
		}
	}), window.indexs = $("#mySwipe .members_flash_time span");
	var f = [];
	$(".j-swipe").each(function(a, b) {
		$(this).attr("id", "swiper" + a);
		var c = $(this).attr("id"),
			d = document.getElementById(c);
		f[a] = Swipe(d, {
			startSlide: 0,
			auto: 3e3,
			callback: function(a) {
				$(d).find("span").eq(a).addClass("cur").siblings().removeClass("cur")
			}
		})
	});
	try {
		var e = document.querySelectorAll(".j-swipe");
		window.mySwipe1 = Swipe(e[0], {
			startSlide: 0,
			auto: 3e3,
			callback: function(a) {
				indexs1.eq(a).addClass("cur").siblings().removeClass("cur")
			}
		}), window.indexs1 = $(".j-swipe .members_flash_time span")
	} catch (g) {}
	var h = $(".mdetail_goodsdet_con").width();
	$(".mdetail_goodsdet_tit span").click(function() {
		var c = $(this).index();
		$(this).addClass("cur").siblings().removeClass("cur"), $(".mdetail_goodsdet_con .detailConPanel .detailCon").eq(c).show().siblings().hide(), a(c), b($(".mdetail_goodsdet_con .detailCon:eq(" + c + ")"))
	}), b($(".mdetail_goodsdet_con .members_con:eq(0)")), $(document).on("touchend", ".J-comimg", function(a) {
		var b = $(this).attr("src"),
			c = '<div class="mdetail_conimg"><img src="' + b + '" width="100%"></div>';
		$("body").append(c), $(".mdetail_conimg").click(function() {
			$(this).remove()
		}), a.preventDefault()
	})
	
	
	
	
});
